<script setup lang="ts">
import { computed } from 'vue'

const props = defineProps({
  iconClass: {
    type: String,
    required: true,
  },
  className: {
    type: String,
    default: '',
  },
  iconColor: {
    type: String,
    default: 'CurrentColor',
  },
})
const iconName = computed(() => `#icon-${props.iconClass}`)
const svgClass = computed(() => {
  if (props.className) {
    return 'svg-icon ' + props.className
  } else {
    return 'svg-icon'
  }
})
</script>
<template>
  <svg :class="svgClass" aria-hidden="true">
    <use :href="iconName" :fill="iconColor" />
  </svg>
</template>

<style lang="scss" scoped>
.sub-el-icon,
.nav-icon {
  display: inline-block;
  font-size: 15px;
  margin-right: 12px;
  position: relative;
}

.svg-icon {
  width: 14px;
  height: 14px;
  position: relative;
  fill: currentColor;
  vertical-align: -2px;
}
</style>
